import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import * as path from 'path';
import vueJsx from "@vitejs/plugin-vue-jsx";

// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    //别名设置
    alias: {
      '@': path.resolve(__dirname, 'src')
    },
    extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json']
  },
  //全局css注入
  css: {
		preprocessorOptions: {
			scss: {
				additionalData: `@import "./src/assets/style/mixin.scss";`
			}
		}
	},
  server: {
    port: 3010,
    open: true,
    // proxy: {
    //   '/api': {
    //     target:"",
    //     changeOrigin: true,
    //     rewrite: (path: string) => path.replace(/^\/api/,'')
    //   }
    // }
  },
  build: {
    terserOptions: {
      // 生产环境移除console
      compress: {
        drop_console: true,
        drop_debugger: true
      }
    }
  },
  plugins: [
    vue(),
    vueJsx() //插件使用
  ]
})
